//
//  QueryView.m
//  旅游咨询
//
//  Created by Letme on 15-4-20.
//  Copyright (c) 2015年 xubin. All rights reserved.
//

#import "QueryView.h"

@implementation QueryView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}
- (void)createView
{
    self.backgroundColor = [UIColor whiteColor];
    
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 200, 30)];
    titleLabel.text = @"国外地点";
    titleLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:titleLabel];
    
    
    UIButton *Button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button1.frame = CGRectMake(20, 30, (self.frame.size.width - 80) / 3, 30);
    //Button1.frame = CGRectMake(30, , <#CGFloat width#>, <#CGFloat height#>)
    Button1.backgroundColor = [UIColor redColor];
    [Button1 setTitle:@"法国" forState:UIControlStateNormal];
    [Button1 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button1.titleLabel.font = [UIFont systemFontOfSize:15];
    Button1.tag = 20001;
    [self addSubview:Button1];
    
    UIButton *Button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button2.frame = CGRectMake(Button1.frame.origin.x + Button1.frame.size.width + 20, 30, Button1.frame.size.width, 30);
    Button2.backgroundColor = [UIColor redColor];
    [Button2 setTitle:@"西班牙" forState:UIControlStateNormal];
    [Button2 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button2.titleLabel.font = [UIFont systemFontOfSize:15];
    Button2.tag = 20002;
    [self addSubview:Button2];
    
    UIButton *Button3 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button3.frame = CGRectMake(Button2.frame.origin.x + Button1.frame.size.width + 20, 30, Button1.frame.size.width, 30);
    Button3.backgroundColor = [UIColor redColor];
    [Button3 setTitle:@"意大利" forState:UIControlStateNormal];
    [Button3 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button3.titleLabel.font = [UIFont systemFontOfSize:15];
    Button3.tag = 20003;
    [self addSubview:Button3];
    
    
    UIButton *Button4 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button4.frame = CGRectMake(20, Button1.frame.origin.y + 40, Button1.frame.size.width, 30);
    Button4.backgroundColor = [UIColor redColor];
    [Button4 setTitle:@"英国" forState:UIControlStateNormal];
    [Button4 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button4.titleLabel.font = [UIFont systemFontOfSize:15];
    Button4.tag = 20004;
    [self addSubview:Button4];
    
    UIButton *Button5 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button5.frame = CGRectMake(Button2.frame.origin.x, Button4.frame.origin.y, Button1.frame.size.width, 30);
    Button5.backgroundColor = [UIColor redColor];
    [Button5 setTitle:@"德国" forState:UIControlStateNormal];
    [Button5 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button5.titleLabel.font = [UIFont systemFontOfSize:15];
    Button5.tag = 20005;
    [self addSubview:Button5];
    
    UIButton *Button6 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button6.frame = CGRectMake(Button3.frame.origin.x, Button4.frame.origin.y, Button1.frame.size.width, 30);
    Button6.backgroundColor = [UIColor redColor];
    [Button6 setTitle:@"奥地利" forState:UIControlStateNormal];
    [Button6 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button6.titleLabel.font = [UIFont systemFontOfSize:15];
    Button6.tag = 20006;
    [self addSubview:Button6];
    
    
    
    
    UIButton *Button7 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button7.frame = CGRectMake(20, Button4.frame.origin.y + 40, Button1.frame.size.width, 30);
    Button7.backgroundColor = [UIColor redColor];
    [Button7 setTitle:@"日本" forState:UIControlStateNormal];
    [Button7 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button7.titleLabel.font = [UIFont systemFontOfSize:15];
    Button7.tag = 20007;
    [self addSubview:Button7];
    
    UIButton *Button8 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button8.frame = CGRectMake(Button5.frame.origin.x, Button7.frame.origin.y, Button1.frame.size.width, 30);
    Button8.backgroundColor = [UIColor redColor];
    [Button8 setTitle:@"韩国" forState:UIControlStateNormal];
    [Button8 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button8.titleLabel.font = [UIFont systemFontOfSize:15];
    Button8.tag = 20008;
    [self addSubview:Button8];
    
    
    UIButton *Button9 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button9.frame = CGRectMake(Button6.frame.origin.x, Button7.frame.origin.y, Button1.frame.size.width, 30);
    Button9.backgroundColor = [UIColor redColor];
    [Button9 setTitle:@"土耳其" forState:UIControlStateNormal];
    [Button9 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button9.titleLabel.font = [UIFont systemFontOfSize:15];
    Button9.tag = 20009;
    [self addSubview:Button9];

    
    UIButton *Button10 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button10.frame = CGRectMake(20, Button7.frame.origin.y + 40, Button1.frame.size.width, 30);
    Button10.backgroundColor = [UIColor redColor];
    [Button10 setTitle:@"阿联酋" forState:UIControlStateNormal];
    [Button10 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button10.titleLabel.font = [UIFont systemFontOfSize:15];
    Button10.tag = 20010;
    [self addSubview:Button10];
    
    
    UIButton *Button11 = [UIButton buttonWithType:UIButtonTypeCustom];
    Button11.frame = CGRectMake(Button8.frame.origin.x, Button10.frame.origin.y, Button1.frame.size.width, 30);
    Button11.backgroundColor = [UIColor redColor];
    [Button11 setTitle:@"马来西亚" forState:UIControlStateNormal];
    [Button11 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
    Button11.titleLabel.font = [UIFont systemFontOfSize:15];
    Button11.tag = 20011;
    [self addSubview:Button11];
    
    
//    UIButton *Button12 = [UIButton buttonWithType:UIButtonTypeCustom];
//    Button12.frame = CGRectMake(Button9.frame.origin.x, Button10.frame.origin.y, Button1.frame.size.width, 30);
//    Button12.backgroundColor = [UIColor redColor];
//    [Button12 setTitle:@"印度尼西亚" forState:UIControlStateNormal];
//    [Button12 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
//    Button12.titleLabel.font = [UIFont systemFontOfSize:15];
//    Button12.tag = 20012;
//    [self addSubview:Button12];
//    
//    
//    UIButton *Button13 = [UIButton buttonWithType:UIButtonTypeCustom];
//    Button13.frame = CGRectMake(20, Button10.frame.origin.y + 40, Button1.frame.size.width, 30);
//    Button13.backgroundColor = [UIColor redColor];
//    [Button13 setTitle:@"马来西亚" forState:UIControlStateNormal];
//    [Button13 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
//    Button13.titleLabel.font = [UIFont systemFontOfSize:15];
//    Button13.tag = 20013;
//    [self addSubview:Button13];
//    
//    UIButton *Button14 = [UIButton buttonWithType:UIButtonTypeCustom];
//    Button14.frame = CGRectMake(Button11.frame.origin.x, Button13.frame.origin.y , Button1.frame.size.width, 30);
//    Button14.backgroundColor = [UIColor redColor];
//    [Button14 setTitle:@"美国" forState:UIControlStateNormal];
//    [Button14 addTarget:self action:@selector(mybuttonAction:) forControlEvents:UIControlEventTouchUpInside];
//    Button14.titleLabel.font = [UIFont systemFontOfSize:15];
//    Button14.tag = 20014;
//    [self addSubview:Button14];
    
}

- (void)mybuttonAction:(UIButton *)button
{
    [self.myDelegate goToSecondViewController:button.tag];
}


@end
